<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../layui/css/layui.css" media="all">
<title>药品类型修改</title>
</head>

<body>

	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 20px;">
		<legend>药品类型修改列表</legend>
	</fieldset>

	<form class="layui-form" action="../../../drugType/update.action"
		method="post" id="myform">
		<input type="hidden" id="dtId" name="dtId">
		<div class="layui-form-item">
			<label class="layui-form-label">类型名称</label>
			<div class="layui-input-block">
				<input type="text" name="dtName" id="dtName"
					lay-verify="required" placeholder="请输入" autocomplete="off"
					class="layui-input" maxlength="10">
			</div>
		</div>
		<input type="hidden" id="pids" name="pids">
		<div class="layui-form-item">
			<label class="layui-form-label">上级类型</label>
			<div class="layui-input-block">
				<select name="pid" id="pid"
					autocomplete="off" class="layui-input">
					<option></option>
				</select>
			</div>
		</div>
		<!-- 提交重置 -->
		<div class="layui-form-item">
			<div class="layui-input-block">
				<input  type="submit" class="layui-btn" lay-submit=""
					lay-filter="drugTypeAdd" value="立即提交">
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>

	<script src="../../../layui/layui.js"></script>
	<script type="text/javascript" src="../../../res/wzw/js/jquery.min.1.6.4.js"></script>
	<script src="../../../res/wzw/js/jquery-1.10.2.js"></script>

	<script>
	layui.use(['form', 'layer'], function(){
	  var form = layui.form
	  ,layer = layui.layer
	  ,$ = layui.$;
	  
	  form.on('submit(drugTypeAdd)',function(){
		  parent.location.reload(); // 父页面刷新
	  });
	  
	  var url = "../../../drugType/findByPid.action";
		$.post(url,null,function(data){
			for(var i=0;i<data.length;i++){
				$("#pid").append("<option value="+data[i].dtId+">"+data[i].dtName+"</option>");
			}
			//form表单重新渲染
			form.render();
			var ss = document.getElementById('pids').value;
			document.getElementById('pid').value=ss;
			//form表单重新渲染
			form.render();
		},dataType="JSON");
	});
</script>

</body>
</html>